<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
      
<h:head>
	<title>Crea Pacchetto</title>
	
</h:head>
<h:body>

<div id="spaziatura">
<full_page id="main">
<!-- 		HEADER -->
			<div>
						<img src="../resources/Images/Banner.png" id="bannerTop"></img>
			</div>
<!-- 		HEADER -->
<div>
						<img src="../resources/Images/Banner_piccolo.png" id="bannerBottom_sx"></img>
			</div>

			<div>
						<img src="../resources/Images/Logo_td_big.png" id="logoTD"></img>
			</div>

			<div>
						<img src="../resources/Images/Banner_piccolo_dx.png" id="bannerBottom_dx"></img>
			</div>
			
			<div>
						<img src="../resources/Images/Bg.png" id="background"></img>
			</div>

			<div>
						<img src="../resources/Images/boxsil.png" id="minilogo"></img>
			</div>

<!--TITOLO E SOTTOTITOLO-->
		<title_box>
		<title_TD>TravelDream</title_TD>
		</title_box>
		<!--FINE TITOLO E SOTTOTITOLO-->
		
		<box_login>
				<yellow_text id="topRightReg">Admin Section</yellow_text>
   		</box_login>

<full_page id="demiPageSmall_pacchetto"> 
<!-- 	MENUBAR -->

	<p:menubar autoDisplay="false">
		
			<p:menuitem value="Crea pacchetto" url="CreaPacchetto.xhtml"/>
		
		<p:submenu label="Aggiunta Elementi">
			<p:menuitem value="Aggiungi Città" url="addCitta.xhtml"/>
			<p:menuitem value="Aggiungi Hotel" url="addHotel.xhtml"/>
			<p:menuitem value="Aggiungi Mezzo" url="addMezzo.xhtml"/>
			<p:menuitem value="Aggiungi Escursione" url="addEscursione.xhtml"/>
		</p:submenu>
		<p:submenu label="Modifica Elementi o Pacchetto">
			<p:menuitem value="Modifica Pacchetto" url="modPacchetto.xhtml"/>
			<p:menuitem value="Modifica Hotel" url="modHotel.xhtml"/>
			<p:menuitem value="Modifica Mezzo" url="modMezzo.xhtml"/>
			<p:menuitem value="Modifica Escursione" url="modEscursione.xhtml"/>
		</p:submenu>
		<p:submenu label="Cancella Elementi o Pacchetto">
			<p:menuitem value="Cancella Pacchetto" url="cancPacchetto.xhtml"/>
			<p:menuitem value="Cancella Hotel" url="cancHotel.xhtml"/>
			<p:menuitem value="Cancella Mezzo" url="cancMezzo.xhtml"/>
			<p:menuitem value="Cancella Escursione" url="cancEscursione.xhtml"/>
		</p:submenu>
			<p:menuitem value="Home Admin" url="index.xhtml"/>
	</p:menubar>
	
<!-- 	MENUBAR -->
<h:form onsubmit="#{CreaPP.start()}, #{RetrieveCitta.myCitta()}">
<p:growl id="growl" showDetail="true" sticky="true" />
   <p:panel header="Crea Pacchetto Predefinito"> 
    <h:panelGrid id="PPGrid" columns="3">
    
    		
                   <p:outputLabel for="citta" value="Destinazione" />
               
               
               <p:selectOneMenu id= "citta" value="#{CreaPP.current2.citta}" effect="fade">
                  <f:selectItem itemLabel="Seleziona la tua destinazione" itemValue="" />   
                  <f:selectItems  value="#{RetrieveCitta.cittaL}" var="CittaDTO" 
                  itemLabel="#{CittaDTO.citta}" itemValue="#{CittaDTO.citta}"/>
                  
                  <p:ajax update="hotel"  listener="#{ListenerCitta.selectHotel(CreaPP.current2.citta)}" />
                  <p:ajax update="escursione"  listener="#{ListenerCitta.selectEscursione(CreaPP.current2.citta)}" />  
<!--                   <p:ajax update="cittap"  event="valueChange" /> -->
				  <p:ajax update="mezzoA" listener="#{ListenerCitta.selectMezzo(CreaPP.cittaPartenza,CreaPP.current2.citta)}"/>  
                  <p:ajax update="mezzoR" listener="#{ListenerCitta.selectMezzo(CreaPP.current2.citta,CreaPP.cittaPartenza)}"/>
               </p:selectOneMenu>      

                
              <p:message for="citta"> </p:message>
              
            
           
                   <p:outputLabel for="cittap" value="Città di partenza" />
                
               
               <p:selectOneMenu id= "cittap" value="#{CreaPP.cittaPartenza}" effect="fade">
				  <f:selectItem itemLabel="Scegli da dove partire" itemValue="" />   
                  <f:selectItems  value="#{RetrieveCitta.cittaL}" var="CittaDTO" 
                  itemLabel="#{CittaDTO.citta}" itemValue="#{CittaDTO.citta}"/>
                  
                  <p:ajax update="mezzoA" listener="#{ListenerCitta.selectMezzo(CreaPP.cittaPartenza,CreaPP.current2.citta)}"/>  
                  <p:ajax update="mezzoR" listener="#{ListenerCitta.selectMezzo(CreaPP.current2.citta,CreaPP.cittaPartenza)}"/>
                  
               </p:selectOneMenu>      

              <p:message for="cittap"> </p:message>
               

             
                   <p:outputLabel for="mezzoA" value="Andata" />
               
               
               <p:selectOneMenu id= "mezzoA" value="#{CreaPP.currentA.mezzoDiTrasporto}" effect="fade">
                  <f:selectItem itemLabel="Scegli un'opzione" itemValue="" />   
                  <f:selectItems  value="#{ListenerCitta.LMezzoA}" var="MezzoDTO" 
                  itemLabel="#{MezzoDTO.tipo} #{MezzoDTO.luogoPartenza}-#{MezzoDTO.luogoArrivo} delle #{MezzoDTO.oraPartenza}" itemValue="#{MezzoDTO.idMezzo}"/>
               </p:selectOneMenu>      

               <p:message for="mezzoA"> </p:message>
             
            
                   <p:outputLabel for="mezzoR" value="Ritorno" />
               
               
               <p:selectOneMenu id= "mezzoR" value="#{CreaPP.currentR.mezzoDiTrasporto}" effect="fade">
                  <f:selectItem itemLabel="Scegli un'opzione" itemValue="" />   
                  <f:selectItems  value="#{ListenerCitta.LMezzoR}" var="MezzoDTO" 
                  itemLabel="#{MezzoDTO.tipo} #{MezzoDTO.luogoPartenza}-#{MezzoDTO.luogoArrivo} delle #{MezzoDTO.oraPartenza}" itemValue="#{MezzoDTO.idMezzo}"/>
               </p:selectOneMenu>      

               <p:message for="mezzoR"> </p:message>
              
               
            
                   <p:outputLabel for="hotel" value="Hotel" />
               
               
               <p:selectOneMenu id="hotel" value="#{CreaPP.currentH.nomeHotel}">  
                 <f:selectItem itemLabel="Seleziona uno degli hotel" itemValue="" />  
                 <f:selectItems value="#{ListenerCitta.LHotel}" var="HotelDTO" 
                  itemLabel="#{HotelDTO.nome}" itemValue="#{HotelDTO.nome}"/>  
               </p:selectOneMenu>    

               <p:message for="hotel"> </p:message>
              
                
                 
                   <p:outputLabel for="escursione" value="Escursione" />
              
            
                <p:selectCheckboxMenu id="escursione" value="#{CreaPP.currentE}" label="Escursioni" 
                filter="true" filterText="Filter" filterMatchMode="startsWith" panelStyle="width:600px"> 
<!--                <p:selectOneMenu id="escursione" value="#{CreaPP.currentE.nomeEscursione}">   -->
<!--                  <f:selectItem itemLabel="" itemValue="" />   -->
                 <f:selectItems value="#{ListenerCitta.LEscursione}" var="EscursioneDTO" 
                  itemLabel="#{EscursioneDTO.nomeEscursione}" itemValue="#{EscursioneDTO.nomeEscursione}"/>  
<!--                </p:selectOneMenu>     -->
                 </p:selectCheckboxMenu>

              <p:message for="escursione"> </p:message>
              
                
			  
				<p:outputLabel for="data_Partenza" value="Data Partenza" />
			   			

    			<p:calendar mindate="#{CreaPP.datadiOggi}" readonlyInput="true" pattern="MM/dd/yyyy HH:mm" value="#{CreaPP.current.data_Partenza}" id="data_Partenza" >
    			<p:ajax event="dateSelect"  update="data_Ritorno"/> </p:calendar>
    		 	<p:message for="data_Partenza"></p:message>
			
			
				<p:outputLabel for="data_Ritorno" value="Data Ritorno" />
			  
 			  
 			    <p:calendar readonlyInput="true" pattern="MM/dd/yyyy HH:mm"  value="#{CreaPP.current.data_Ritorno}" id="data_Ritorno" mindate="#{CreaPP.current.data_Partenza}"> </p:calendar>
 			    
			 	 <p:message for="data_Ritorno"></p:message>
			
				
			
				<p:outputLabel for="nome" value="Nome Pacchetto"/>
			             
				<p:inputText id="nome"  value="#{CreaPP.current.nome}" />
			 <p:message for="nome"></p:message>
                <p:outputLabel value="Tipo" />
             
			  
			  
				<p:selectOneMenu value="#{CreaPP.current.tipo}" id= "tipo" >
				   <f:selectItem itemLabel="predefinito" itemValue="predefinito"/>
                </p:selectOneMenu>
                
                
            <p:message for="tipo"></p:message>
            
           
				<p:outputLabel for="email" value="Creato da:" />
				<p:selectOneMenu value="#{CreaPP.current.email}" id= "email" >
				   <f:selectItem itemLabel="#{userBean.email}" itemValue="#{userBean.email}" />
                </p:selectOneMenu>
				 
			
            
	</h:panelGrid>
	<br> </br>
	<button_selector id="bottomRight"><p:commandButton value="Crea!" update="growl" action="#{CreaPP.create}"/></button_selector>
</p:panel>
</h:form>

</full_page>

</full_page>
</div>

<h:outputStylesheet library="css" name="css_rules_plain_links.css" />
</h:body>
</html>